package com.brooks.demo;

/**
 * synchronized同步
 * @Author mihutu
 * @Date 2020/10/16 15:12
 * @Version 1.0
 */
public class DemoThread5 implements Runnable{
    private int COUNT = 100;

    @Override
    public synchronized void run() {
        COUNT--;
        System.out.println(Thread.currentThread().getName() +" count="+ +COUNT);
    }

    public static void main(String[] args) {
        DemoThread5 t = new DemoThread5();
        for (int i=0;i<100;i++){
            new Thread(t,"Thread"+i).start();
        }
    }
}